package com.hmall.search.config;

import com.hmall.search.interceptor.UserInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Description WebConfig
 * @Author dmx
 * @Date 2024-11-16
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new UserInterceptor())
                .addPathPatterns("/**") ; // 拦截所有路径
               // .excludePathPatterns("/public/**");  // 排除某些路径
    }
}
